﻿using System;
using System.Data.SqlClient;
using System.Runtime.Serialization;
using Devv.Core.UniDataTier;

namespace BikeBouncer.BusinessLayer.Entities
{
	[DataContract, Serializable]
	public class Maker : BaseEntity
	{
		#region Properties

		[DataMember]
		public String Title { get; set; }

		[DataMember]
		public String Website { get; set; }

		#endregion

		#region Extra properties

		public String Code
		{
			get
			{
				return GetCode(Title);
			}
		}

		#endregion

		#region Constructor

		public Maker()
		{
		}

		public Maker(Int32 id)
		{
			Construct(DataAccess.Maker_Get(id));
		}

		public Maker(SqlDataReader reader)
		{
			Construct(reader);
		}

		#endregion

		#region Loading

		public override void Load(SqlDataReader reader)
		{
			Id = DataHandler.GetInt32(reader, "MakerId");
			Title = DataHandler.GetString(reader, "MakerTitle");
			Website = DataHandler.GetString(reader, "MakerWebsite");
			Active = DataHandler.GetBoolean(reader, "MakerActive");
		}

		#endregion
	}
}